//
//  DDTabBarController.m
//  LYJR_XDD
//
//  Created by 肖棟棟 on 16/8/6.
//  Copyright © 2016年 肖棟棟. All rights reserved.
//

#import "DDTabBarController.h"
#import "DDNavigationController.h"
#import "DDMarketViewController.h"
#import "DDFindViewController.h"
#import "DDAcountViewController.h"

@interface DDTabBarController ()

@end

@implementation DDTabBarController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
   [self setupChildViewControllers];
    
}

-(void)setupChildViewControllers{
   
    [self setupChildViewController:[[DDMarketViewController alloc ] init] titel:@"首页" imageName:@""];
//
    [self setupChildViewController:[[DDFindViewController alloc ] init] titel:@"发现" imageName:@"tabbar_message_center"];
//
    [self setupChildViewController:[[DDAcountViewController alloc ] init] titel:@"账户" imageName:@"tabbar_discover"];
//

    
}

-(void)setupChildViewController:(UIViewController *)vc titel:(NSString *)title imageName :(NSString *)imageName{
    
    vc.title = title;
    vc.tabBarItem.image = [UIImage imageNamed:imageName];
    
    NSString * selectName = [NSString stringWithFormat:@"%@_selected",imageName];
    vc.tabBarItem.selectedImage = [[UIImage imageNamed:selectName] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    //设置字体颜色
    [vc.tabBarItem setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor orangeColor]} forState:UIControlStateSelected];
    [self addChildViewController:[[DDNavigationController alloc] initWithRootViewController:vc]];
    
}

@end
